﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using YmSoft.WPF.Core;

namespace YmSoft.WPF.WenShiCanShuSheZhi
{
    /// <summary>
    /// CrlMain.xaml 的交互逻辑
    /// </summary>
    public partial class CrlMain : UserControl
    {
        public CrlMain()
        {
            InitializeComponent();
        }

        ICommand navBarItemCommand = null;
        public ICommand NavBarItemCommand
        {
            get
            {
                if (navBarItemCommand == null)
                {
                    navBarItemCommand = new ParameterCommand(
                        (p) =>
                        {
                            var key = p.ToString();
                            var ary = key.Split(',');
                            var typeName = "YmSoft.WPF.WenShiCanShuSheZhi." + ary[0];
                            var type = Type.GetType(typeName);
                            var page = Activator.CreateInstance(type);
                            crlContentControl.Content = page;
                        });
                }
                return navBarItemCommand;
            }
        }
    }
}
